arraylist<String>出错

来源:百度知道 编辑:UC知道 时间:2024/06/28 17:27:20
import java.util.ArrayList;
public class Responder {
private ArrayList<String>responses;
public Responder()
{
responses=new ArrayList<String>();
}
}
这个程序不能编译通过,提示:
The type ArrayList is not generic; it cannot be parameterized with arguments <String>
解释一下这是怎么回事。

private List<String> responses;

数组链表 链表的元素 应该是数组的形式
string不是c风格的数组字符串,而是c++的字符串流,他们是两个概念,所以我认为不可以定义String的数组链表